using ProjectDanmaku.Scenario;
using UnityEngine;

namespace ProjectDanmaku.Entity.Manipulator
{
    public class DeathZoneCheckManipulator : IEntityManipulator
    {
        public void Do(EntityData entityData)
        {
            var zone = DanmakuScenario.BulletDeathZone;
            
            if (zone.w < 0.5f)
                return;

            var zonePos = new Vector2(zone.x, zone.y);
            var ePos = entityData.Position;

            if ((zonePos - ePos).magnitude < zone.z)
            {
                entityData.Destroyed = true;
                entityData.Active = false;
            }
        }
    }
}